package com.flight.trans.adapter;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.flight.trans.R;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;
import com.flight.trans.bean.LeavePortGroupBoardDetailBean.GroupBoardDetailData.DetailsOrderData;
import com.flight.trans.global.Constant;
import com.flight.trans.util.CommonUtils;

import java.util.List;

/**
 * 出港组板
 */
public class LeavePortGroupBoardDetailsSeeAdapter extends BaseRecyclerAdapter<DetailsOrderData> {

    private int size;

    public LeavePortGroupBoardDetailsSeeAdapter(Context mContext, List<DetailsOrderData> mList , int size) {
        super(mContext, mList);
        this.size = size ;
    }

    @Override
    public int getItemCount() {
        return size;
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_leave_port_group_board_details_see;
    }

    @Override
    protected void bindData(BaseViewHolder holder, DetailsOrderData data, int position) {

        TextView mTvPosition = holder.findViewById(R.id.mTvPosition);//序号
        TextView mTvOrderNo = holder.findViewById(R.id.mTvOrderNo);//运单号
        TextView mTvProductName = holder.findViewById(R.id.mTvProductName);//品名
        TextView mTvContainerNo = holder.findViewById(R.id.mTvContainerNo);//容器号
        TextView mTvCount = holder.findViewById(R.id.mTvCount);//件数
        TextView mTvWeight = holder.findViewById(R.id.mTvWeight);//重量
        TextView mTvDeep = holder.findViewById(R.id.mTvDeep);//目的地

        CommonUtils.setScreenViewVisible(mTvCount);
        CommonUtils.setScreenViewVisible(mTvWeight);
        mTvOrderNo.setBackground(data.getPriorMark() == Constant.Prior_Mark ? mContext.getDrawable(R.mipmap.icon_prepare) : null);

        mTvPosition.setText((position + 1) + "");

        mTvOrderNo.setText(data.getOrderNo());
        mTvProductName.setText(data.getTradeName());
        mTvContainerNo.setText(data.getTransportCode());
        mTvCount.setText(String.valueOf(data.getNumber()));
        mTvWeight.setText(String.valueOf(data.getWeight()));
        mTvDeep.setText(String.valueOf(data.getDeap()));
    }
}
